package puj.promobil.prometer.fragmento;

import puj.promobil.prometer.R;
import puj.promobil.prometer.dto.Producto;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.RelativeLayout;

public class ImagenView extends ImageView {
	
	private ImageView image=null;
	private Button actualizar=null;
	private Button borrar=null;
	private Button medidas=null;
	private Producto producto;

	public ImagenView(Context context, Producto producto) {
		super(context);
		
		this.producto=producto;
		
		//LayoutParams params = new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT);
		//params.setMargins(4, 4, 4, 4);		
		//this.setLayoutParams(params);

		image=new ImageView(context);
	
		//image.setLayoutParams(new LayoutParams(150,150));
		
		
		byte ima[] = producto.getImagen();
		if (ima != null && ima.length > 0) {
			Bitmap bitmap = BitmapFactory.decodeByteArray(ima, 0, ima.length);
			this.setImageBitmap(bitmap);
			this.buildDrawingCache();
		}
		
		//actualizar=new Button(context);
		//actualizar.setText("Act");
		
		/*borrar=new Button(context);
		medidas=new Button(context);*/
		
	}

}
